// JavaScript Document
var td_id = null;
var t_level = null;
var xmlHttp
function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
 	{
 // Firefox, Opera 8.0+, Safari
 		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
 //Internet Explorer
 		try
  		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}

function getSubCat(cat_id)
{   
   xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		 alert ("Browser does not support HTTP Request")
		 return
	}
 	if(cat_id == " ")
 	{
 	  alert("You enter null value")
  	}
  	else
 	{
		var url="ajax.php"
		url=url+"?cat_id="+cat_id
		url=url+"&action=getsubcat"
		url=url+"&id="+Math.random()
		xmlHttp.onreadystatechange=stateChangedCat
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
	}	
}
function stateChangedCat() 
{ 
    if (xmlHttp.readyState!=4 ||  xmlHttp.readyState!="complete")
	{ 
		document.getElementById("imgdiv").innerHTML='<img src="images/load.gif">'
	}
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("imgdiv").innerHTML=''
		document.getElementById("sub_cat_div").innerHTML=xmlHttp.responseText 
	}
}
